import axios from 'axios'
import { HOST } from './config'

// 创建axios实例
const service = axios.create({
  baseURL: HOST.url, // api的base_url
  timeout: 5000 //超时时间
})

// // request拦截器
service.interceptors.request.use(config => {

  return config
}, error => {
  Promise.reject(error)
})

// respone拦截器
service.interceptors.response.use(
  response => {
      return response.data;
  },
  error => {
    return Promise.reject(error)
  }
)


export default service
